﻿{%include file="m.index.header.tpl.php"%}
<!--主体部分-->

<div class="container" style="margin-top:70px;">
    <form name="form1" action="" method="get">
    <div class="row" style="margin-top:10px;">
        <div class="col-sm-12 distance" >
            <div class="form-group">
                <label for="" class="col-sm-2 control-label">学年学期：</label>
                <div class="col-sm-10">
                    <select class="form-control" id="semester_id" name="semester_id">
                        <option value="0">-请选择-</option>
                        {%foreach from=$semester_lists key=key item=value%}
                        <option value="{%$value.semester_id%}">{%$value.semester_name%}</option>
                        {%/foreach%}
                    </select>
                </div>
            </div>
        </div>
        <div class="col-sm-12 distance" >
            <div class="form-group">
                <label for="" class="col-sm-2 control-label">考试名称：</label>
                <div class="col-sm-10">
                    <select class="form-control" id="exam_name" name="exam_id">
                        <option value="0">-请选择-</option>
                    </select>
                </div>
            </div>
        </div>
        <div class="col-sm-12 distance" >
            <div class="form-group">
                <label for="" class="col-sm-2 control-label">年级：</label>
                <div class="col-sm-10">
                    <select class="form-control" name="grade_id">
                        {%foreach from=$grade_lists key=key item=value%}
                        <option value="{%$value.grade_id%}">{%$value.grade_name%}</option>
                        {%/foreach%}
                    </select>
                </div>
            </div>
        </div>
        <div class="col-xs-12  distance ">
            <div class="form-group">
                <div class="col-sm-10  text-center">
                    <input type="hidden" name="a" value="score.gradelist">
                    <button class="btn btn-success" type="submit"  style="width:80%">搜索</button>
                </div>
            </div>
        </div>
    </div>
    </form>
    <div class="row" style="margin-top:15px;margin-left:1px; margin-right:1px;">
        {%foreach from=$data_lists key=key item=value%}
        <table class="table table-striped table-bordered text-center"  id="middles">

            <tr>
                <td>班级</td>
                <td>{%$value.class_name%}</td>
            </tr>
            <tr>
                <td>各科平局分</td>
                <td><table  class="table table-striped table-bordered text-center" >
                        {%foreach from=$value.vscore key=k item=v%}
                        <tr>
                            <td>{%$k%}:{%$v%};</td>
                        </tr>
                        {%/foreach%}

                    </table></td>
            </tr>
            <tr>
                <td>总平均分</td>
                <td>{%$value.total%}</td>
            </tr>

            <tr>
                <td>班级总分平均排名</td>
                <td>{%$value.class_rank%}</td>
            </tr>
        </table>
        {%/foreach%}
    </div>
</div>
  <!--主要内容结束-->
{%include file="m.index.footer.tpl.php"%}
 <!--二级联动-->
  <script type="text/javascript">
        $(document).ready(function () {
             $("#semester_id").change(function () {		
                 if ($(this).val() == "-1") {
					$("#industr").remove(); return; 
					}
                else {
			var timestamp = new Date().getTime();
			$.ajax({
			url:"index.php?a=exam.listBySemesterJson",
			type:"get",
			data: "semester_id=" + $("#semester_id").find("option:selected").val() + "&timestamp=" + timestamp,
			dataType:"json",
			success:function(msg){
                             var industr = "";
                             $.each(msg, function (n, v) {
                                industr += ("<option value=\"" + n + "\">" + v);
                                industr += ("</option>");
                            });
                             $("#exam_name").html(industr);			   			   
			}
			});					
                 }

            });

        });
</script>
       
